{% set uniqid = uniqid ?? uniqid('user_') %}
{% set idBase = "postgresql-users-#{uniqid}" %}
{% set nameBase = "postgresql[users][#{uniqid}]" %}

{% set superUser = (user.superuser is defined and user.superuser) ? true : false %}

<div id="{{ idBase }}" data-uniqid="{{ uniqid }}" data-name="{{ nameBase }}"
     class="tab-pane {{ active is defined and active ? 'active' }}">
    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-username">
            Username
        </label>
        <input type="text" id="{{ idBase }}-username"
               name="{{ nameBase }}[username]"
               placeholder="username" class="form-control"
               value="{{ user.username }}" />
        <div class="help-block">
            This is the ID used within the <code>Vagrantfile</code>. It is only used
            for your internal identification.
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-password">
            Password
        </label>
        <input type="text" id="{{ idBase }}-password"
               name="{{ nameBase }}[password]"
               placeholder="123" class="form-control"
               value="{{ user.password }}" />
        <div class="help-block">
            Password is required for each user.
        </div>
    </div>

    <div class="clearfix"></div>

    <div class="form-group col-xs-12">
        <div class="clearfix"><label>Superuser</label></div>

        <div class="checkbox">
            <input type="checkbox" id="{{ idBase }}-superuser"
                   name="{{ nameBase }}[superuser]"
                   value="1"
                   {% if superUser %}checked{% endif %} />
            <label for="{{ idBase }}-superuser">
                Grant this user superuser role
            </label>
        </div>
    </div>

    <div class="clearfix"></div>
</div>
